﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Xml;

namespace XhPaper
{
    public class MyTableBase:MyAutoCadObjectBase
    {
        IMyInterface m_iTable;
        public List<MyLine> m_LieLines;
        public List<MyLine> m_HangLines;
        public List<MyLine> m_QiTaLines;
        public Dictionary<string, MyText> m_TableNameDic;
        public Dictionary<string, MyText> m_TableTextDic;
      
        public IMyInterface ITable
        {
            get { return m_iTable; }
            set { m_iTable = value; }
        }
        public MyTableBase()
        {

        }
        public MyTableBase(double left, double top, MyAutoCadObjectBase container)
            : base(left,top,container)
        {
        }
        public virtual void CreateTable()
        {
        }
        public override void MyDraw(MyCadDll.MyCad mycad)
        {
            base.MyDraw(mycad);
            foreach (MyLine myline in m_LieLines)
            {
                myline.MyDraw(mycad);
            }
            foreach (MyLine myline in m_HangLines)
            {
                myline.MyDraw(mycad);
            }

            foreach (MyText mytext in m_TableNameDic.Values)
            {
                mytext.MyDraw(mycad);
            }
            foreach (MyText mytext in m_TableTextDic.Values)
            {
                mytext.MyDraw(mycad);
            }
        }
    }
    public class MyTuZhi : MyAutoCadObjectBase
    {
        public MyTuZhi()
        {

        }
        public MyTuZhi(double left, double top ,MyAutoCadObjectBase container):base(left,top,container)
        {

        }
        MyTuZhi CreateTuZhi(double left, double top ,MyAutoCadObjectBase container)
        {
            return new MyTuZhi(top, left, container);
        }
        MyJdq CreateJdq()
        {
            return null;
        }
        MyJkb CreateJkb()
        {
            return null;
        }

    }
    public class MyJdq : MyTableBase
    {     
        public MyJdq()
        {
        }
        public MyJdq(double left, double top, MyAutoCadObjectBase container)
            : base(left + container.Left, container.Top+top, container)
        {          
             ITable = new MyXmlTableJdq();
             m_HangLines= ITable.GetHangLines(this);
             m_LieLines = ITable.GetLieLines(this);
             m_QiTaLines = ITable.GetQiTaLines(this);
             ITable.GetNameTextDic(this, out m_TableNameDic, out m_TableTextDic);
        }
       
        //public override void MyDraw(MyCadDll.MyCad mycad)
        //{
        //    base.MyDraw(mycad);
        //    foreach (MyLine myline in m_LieLines)
        //    {
        //        myline.MyDraw(mycad);
        //    }
        //    foreach (MyLine myline in m_HangLines)
        //    {
        //        myline.MyDraw(mycad);
        //    }
          
        //    foreach (MyText mytext in m_TableNameDic.Values)
        //    {
        //        mytext.MyDraw(mycad);
        //    }
        //    foreach (MyText mytext in m_TableTextDic.Values)
        //    {
        //        mytext.MyDraw(mycad);
        //    }
        //}
    }
    public class MyJkb : MyTableBase
    {
        public MyJkb()
        {
        }
        public MyJkb(double left, double top, MyAutoCadObjectBase container)
            : base(left + container.Left, container.Top+top, container)
        {
            ITable = new MyXmlTableJkb3(8);
            m_HangLines = ITable.GetHangLines(this);
            m_LieLines = ITable.GetLieLines(this);
            ITable.GetNameTextDic(this, out m_TableNameDic, out m_TableTextDic);
            for (int i = 0; i < 8; i++)
            {
                (m_TableTextDic[i.ToString()] as MyJkbText3).JkbName.Text = "name";
                (m_TableTextDic[i.ToString()] as MyJkbText3).WeiZhi.Text = "1";
                (m_TableTextDic[i.ToString()] as MyJkbText3).SheBeiNameI.Text = "2";
                (m_TableTextDic[i.ToString()] as MyJkbText3).CaiJiI1.Text = "3";
                (m_TableTextDic[i.ToString()] as MyJkbText3).CaiJiI2.Text = "4";
                (m_TableTextDic[i.ToString()] as MyJkbText3).OutNameI.Text = "5";
                (m_TableTextDic[i.ToString()] as MyJkbText3).OutI.Text = "6";
                (m_TableTextDic[i.ToString()] as MyJkbText3).Dy.Text = "7";

                (m_TableTextDic[i.ToString()] as MyJkbText3).SheBeiNameII.Text = "22";
                (m_TableTextDic[i.ToString()] as MyJkbText3).CaiJiII1.Text = "32";
                (m_TableTextDic[i.ToString()] as MyJkbText3).CaiJiII2.Text = "42";
                (m_TableTextDic[i.ToString()] as MyJkbText3).OutNameII.Text = "52";
                (m_TableTextDic[i.ToString()] as MyJkbText3).OutII.Text = "62";

                (m_TableTextDic[i.ToString()] as MyJkbText3).SheBeiNameIII.Text = "23";
                (m_TableTextDic[i.ToString()] as MyJkbText3).CaiJiIII1.Text = "33";
                (m_TableTextDic[i.ToString()] as MyJkbText3).CaiJiIII2.Text = "43";
                (m_TableTextDic[i.ToString()] as MyJkbText3).OutNameIII.Text = "53";
                (m_TableTextDic[i.ToString()] as MyJkbText3).OutIII.Text = "63";

            }
        }
    }
    public class MyDyHuanXian : MyTableBase
    {
        private bool m_isFirst;
        public MyDyHuanXian()
        {
        }
        public MyDyHuanXian(double left, double top, MyAutoCadObjectBase container,bool isFirst)
            : base(left + container.Left, container.Top+top, container)
        {
            m_isFirst = isFirst;
            ITable = new MyXmlDyHuan();
            m_HangLines = ITable.GetHangLines(this);
            m_LieLines = ITable.GetLieLines(this);
        }
      
    }
    public class MyDataHuanXian : MyTableBase
    {
        private bool m_isFirst;
        public MyDataHuanXian()
        {

        }
        public MyDataHuanXian(double left, double top, MyAutoCadObjectBase container,bool isFirst)
            : base(left + container.Left, container.Top+top, container)
        {
            m_isFirst = isFirst;
            ITable = new MyXmlDyHuan();
            m_HangLines = ITable.GetHangLines(this);
            m_LieLines = ITable.GetLieLines(this);
        }
    }
}
